package com.example.ribbonconsumer.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by yxw on 2017/8/25.
 */
@RestController
public class RibbonController {

    @Autowired
    RestTemplate restTemplate;

    @RequestMapping(value = "ribbon-consumer2", method = RequestMethod.GET)
    public String helloConsumer() {
        return restTemplate.getForEntity("http://hello-server/hello", String.class).getBody();
    }
}

